﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AgencyEntityLib.BaseEntity;
using Ecopsy.DataTier;

/// <summary>
/// Представление стороны в гриднике
/// </summary>
public class grdSide:EntitySingle
{
    public grdSide(SideLst.SideItemBox Source) { _Source = Source; }
    
    public grdSide() {}

    protected SideLst.SideItemBox _Source = null;

    public SideLst.SideItemBox Source { get { return _Source; } set { _Source = value; } }

    public override string ID
    {
        get
        {

            return Side.ID;
        }
        set
        {
            base.ID = value;
        }
    }
    
    public Side Side { get { return _Source.Side; } }

    public int SurfaceCount { get { return _Source.Side.SurfaceCount; } }

    public bool ImSelected { get; set; }
    
    public grdConstraction grdConstraction
    {
        get
        {
            return new grdConstraction(_Source.Constraction);
        }
    }
    
    public string FullAdress
    {
        get { return grdConstraction.FullAdress; }
    }

    public string GID
    {
        get { return grdConstraction.Number + _Source.Side.Litera ; }
    }


    
    public virtual string Litera { get { return _Source.Side.Litera; } }

    public bool Light { get { return _Source.Constraction.bLight; } }

    
    
    public virtual string FullGID
    {
        get { return grdConstraction.Number + Side.Litera; }
    }
    
    /// <summary>
    /// Последняя цена согласно прайс листа
    /// </summary>
    public int Price 
    { 
        get { return Side.CurrentPrice; }     
    }

    public string ConstractionTypeName
    {
        get { return grdConstraction.ConstractionTypeName; }
    }
    
    public string ConstractionNumber { get { return grdConstraction.Number; } }

}

/// <summary>
/// представление стороны с информацией о загрузке
/// </summary>
public class grdSideWitchShedule : grdSide
{   
    public grdSideWitchShedule(SideListWithContracts.SideContractItemBox Source  )
    {   
        _Source = (Source as SideLst.SideItemBox);
    }

    /// <summary>
    /// Расписание стороны 
    /// </summary>
    public SideShedule SideShedule
    { get { return (_Source as SideListWithContracts.SideContractItemBox).Shedule; } }

}




